{include file="admin/top.php" subject='income'}
{include file="income/top.php" subject='income'}

<div id="content">

    <div id="boxquery2">
    <form method="get">
     <input type="hidden" name="m" value="inventory" />
        <input type="hidden" name="s" value="income.php" />
        <input type="button" value="重置" class="fr" onclick="location.href='{$site_admin}m=inventory&s=income.php'" />
        <input type="submit" value="查询" class="fr" />
        <li>仓库:&nbsp; <select id="shopid" name="shopid"><option value="">全部</option>{shops}<option value="{$shops.id}" {if $shops.id==$smarty.get.shopid}selected{/if}>{$shops.title}</option>{/shops}</select></li>
        <li class="yui-skin-sam">入库时间:&nbsp; 
            <input id="sdate3" name="sdate3" type="text" size="12" value="{$smarty.get.sdate3}" onfocus="lockinput(this)" />
            <input id="edate3" name="edate3" type="text" size="12" value="{$smarty.get.edate3}" onfocus="lockinput(this)" />
            <div id="calContainer" style="display:none; position:absolute;"></div>
        </li>
        <li>所属采购单:&nbsp; <input id="paper_name" name="paper_name" type="text" value="{$smarty.get.paper_name}" />
        <li><div style="line-height: 15px;float:left;">产品ID:&nbsp; </div><textarea id="product_id" name="product_id" style="resize:horizontal;float:left;height:30px;">{$smarty.get.product_id}</textarea>
        </li>
        <li>产品关键字:&nbsp; <input id="keywords" name="keywords" type="text" size="30" value="{$smarty.get.keywords}" /> <!-- onclick="select()" --> 
<!--         oninput="context_menu_products(this, 'productid=[id],keywords=[title]')" onfocus="context_menu_products(this, 'productid=[id],keywords=[title]')" /> -->
<!--         <input id="productid" name="productid" type="hidden" value="{$smarty.get.productid}" /> -->
        </li>
         <li>单价:&nbsp; <input id="lprice" name="lprice" type="text" size="6" value="{$smarty.get.lprice}"/>-<input id="hprice" name="hprice" type="text" size="6" value="{$smarty.get.hprice}"/>
        </li>
        <li>数量:&nbsp; <input id="lnumber" name="lnumber" type="text" size="6" value="{$smarty.get.lnumber}"/>-<input id="hnumber" name="hnumber" type="text" size="6" value="{$smarty.get.hnumber}"/>
        </li>
        <li>供应商:&nbsp;
        <input name="supplier" type="text" id="supplier" value="{$smarty.get.supplier}" size="16" onclick="select()"
        oninput="context_menu_suppliers(this, 'supplierid=[id],supplier=[title]')"
        onfocus="context_menu_suppliers(this, 'supplierid=[id],supplier=[title]')" />
        </li>
         <li>类型:&nbsp; <select id="type" name="type"><option value="">全部类型</option>{html_options options=$type selected=$smarty.get.type}</select></li>
         <li class="yui-skin-sam">到货时间:&nbsp; 
            <input id="sdate1" name="sdate1" type="text" size="12" value="{$smarty.get.sdate1}" onfocus="lockinput(this)" />
            <input id="edate1" name="edate1" type="text" size="12" value="{$smarty.get.edate1}" onfocus="lockinput(this)" />
        </li>
        <li>&nbsp;&nbsp;&nbsp;产品批号:&nbsp; <input id="lotnumber" name="lotnumber" type="text" size="30"  value="{$smarty.get.lotnumber}" />
        </li>
        <li>&nbsp;&nbsp;&nbsp;产品条码:&nbsp; <input id="barcode" name="barcode" type="text" size="15"  value="{$smarty.get.barcode}" />
        </li>
        <li class="yui-skin-sam" style="display:none;">保质期:&nbsp; 
            <input id="sdate2" name="sdate2" type="text" size="12" value="{$smarty.get.sdate2}" onfocus="lockinput(this)" />
            <input id="edate2" name="edate2" type="text" size="12" value="{$smarty.get.edate2}" onfocus="lockinput(this)" />
        </li>
                <li>状态:&nbsp; <select id="status" name="status"><option value="all" >全部</option><option value="0" {if !$smarty.get.status or "0"===$smarty.get.status}selected{/if}>未处理</option><option value="1" {if "1"===$smarty.get.status}selected{/if}>已入库</option><option value="-1" {if "-1"===$smarty.get.status}selected{/if}>未入库</option></select></li>
    </form>
    </div>
	<form action="{$site_admin}m=inventory&s=income.php&uri=stockconfirm" method="post" onsubmit="return confirm('操作数据后不可恢复, 确定入库?')">
    <table width="100%" border="0" cellspacing="0" cellpadding="0" id="lister">
      <tbody>
      <tr id="title">
        {if $smarty.get.status==='0' or $smarty.get.status==''}<td width="40"><input type="checkbox" class="checkall" ></td>{/if}
<!--         <td width="40">序号</td> -->
        <td>采购单</td>
        <td>仓库</td>
        <td>供应商</td>
        <td width="40">产品ID</td>
        <td>产品图</td>
        <td>产品名称</td>
        <td>批号</td>
        <td>规格</td>
        <td>单位</td>
<!--         <td>保质期</td> -->
        <td>入库数量</td>
        <td>入库类型</td>
        <td>到货时间</td>
        <td>入库时间</td>
        <td>入库状态</td>
        <td>采购员</td>
        <td>入库员</td>
        <td></td>
      </tr>
      {income limit=20 pager=pager page=$segment.page order="a.id desc" shopid=$smarty.get.shopid product_id=$smarty.get.product_id keywords=$smarty.get.keywords paper_name=$smarty.get.paper_name sdate3=$smarty.get.sdate3 edate3=$smarty.get.edate3 sdate1=$smarty.get.sdate1 edate1=$smarty.get.edate1 sdate2=$smarty.get.sdate2 edate2=$smarty.get.edate2 counter=1 type=$smarty.get.type supplier=$smarty.get.supplier lprice=$smarty.get.lprice hprice=$smarty.get.hprice lnumber=$smarty.get.lnumber hnumber=$smarty.get.hnumber lotnumber=$smarty.get.lotnumber status=$smarty.get.status barcode=$smarty.get.barcode}
      <tr id="content">
        {if $smarty.get.status==='0' or $smarty.get.status==''}<td><input type="checkbox" value="{$income.id}" class="checkitem" name="chk[]" {if !$income.timeexpress}disabled{/if}></td>{/if}
<!--         <td>{$income.id}</td> -->
        <td>{$income.paper_name}</td>
        <td>{if $income.shop_name}{$income.shop_name}{else}{$income.shop}{/if}</td>
        <td>{if $income.supplier_name}{$income.supplier_name}{else}{$income.supplier}{/if}</td>
        <td>{$income.pid}</td>
        <td width="50">{if $income.product_pic}<img src="{$income.product_pic}" width="50" height="50"/>{else}暂无图片{/if}</td>
        <td width="200">{$income.product_name}</td>
        <td>{$income.lotnumber}</td>
        <td>{$income.spec}</td>
        <td>{$income.unit}&nbsp;</td>
<!--         <td>{$income.timeend|date_format:"%Y-%m-%d"}</td> -->
        <td align="center">{$income.number+0}</td>
        <td>{$income.type}</td>
        <td>{if $income.timeexpress>0}{$income.timeexpress|date_format:"%Y-%m-%d"}{/if}</td>
        <td>{if $income.timestocked>0}{$income.timestocked|date_format:"%Y-%m-%d"}{/if}</td>
         <td>{if $income.timestocked>0}<span  style="color: green">已入库</span>{elseif $income.timestocked==0}{if $income.timeexpress}{rights right='purchases_stock'}<a href="{$site_admin}m=inventory&s=income.php&purchases_id={$income.id}&uri=stockconfirm"  onclick="return confirm('操作不可恢复, 确定入库?')">确认入库？</a>{/rights}
        {else}未处理{/if}{else}<span  style="color: red">未入库</span>{/if}</td>
        
         <td>{$income.puser}</td>
        <td>{$income.suser}</td>
        <td align="right">
        {if !$income.timestocked}
<!--         {rights right='income_remove'}<a href="{$site_admin}m=inventory&s=income.php&purchases_id={$income.id}&uri=remove" onclick="return confirm('删除数据不可恢复, 确定删除?')">删除</a>{/rights} -->
        {rights right='income_modify'}<a href="{$site_admin}m=inventory&s=income.php&purchases_id={$income.id}&uri=modify&page={$segment.page}">编辑</a>{/rights}
        {/if}
        <a href="{$site_admin}m=inventory&s=income.php&purchases_id={$income.id}&uri=view&page={$segment.page}&status={$smarty.get.status}">查看</a>
        </td>
      </tr>
      {/income}
      {if $pager->rows==0}
      <tr id="content">
        <td colspan="19">&nbsp;</td>
      </tr>
      {/if}
      </tbody>
      	{if $smarty.get.status==='0' or $smarty.get.status==''}<tfoot>
            <tr>
                <td colspan="19">
	                <input type="hidden" name="act" value="op" />
                    <input type="submit" value="批量入库" />
                </td>
            </tr>
        </tfoot>{/if}
    </table>
    <div id="pager" class="mt10">
        {if $pager}<span class="fr"><strong>合计</strong>: 入库数量:{$income.counter.number+0} /&nbsp; 总价:{$income.counter.price+0}</span> 共{$pager->rows}条记录 第{$pager->pagecurrent}/{$pager->pages}页 {/if} 		
        {if $pager->current > 1}<a href="{url s1=1}">首页</a>{/if}
        {if $pager->current > 1}<a href="{url s1=$pager->current-1}">上页</a>{/if}
        {if $pager->current < $pager->pages}<a href="{url s1=$pager->current+1}">下页</a>{/if}
        {if $pager->current < $pager->pages}<a href="{url s1=$pager->pages}">尾页</a>{/if}
	</div>
	</form>
	<p>&nbsp;</p>
    {rights right='income_create'}<ul id="addmenu"><li><a href="{$site_admin}m=inventory&s=income.php&uri=create">添加一个新的产品入库</a></li></ul>{/rights}
     <form method="post" target="export_iframe" id="export_form" action=""><input type="hidden" value="export" name="act"/></form>
    <iframe src="" style="display:none;" id="export_iframe" name="export_iframe"></iframe>
    <div style="float:right" id="els_export">
            <a href="javascript:;" onclick="$('#export_form').submit();">导出EXCEL</a></div>
    
</div>
{include file="admin/bottom.php"}
</body>
</html>
